<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-menu default-active='active' mode='horizontal' class='menu-unit'>
          <el-menu-item v-for='item in Container2' :index="'产品报价'===item.name?'active':'default'">
            <el-link @click="gotoMenu(item.url)" :type="'产品报价'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
        <table cellpadding="4" cellspacing="0" border="0" width="100%">
          <tr>
            <td class="containerBack">
              <el-form ref="form" :model="quo" :rules="rules" label-width="100px" id="mvcfm">
                <el-button @click="('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
                <el-button @click="gotoPage('/crm/sale/Offer?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>取消</el-button>
                <div class="form-unit">
                  <span class="mvc-title-left"> 添加新报价 </span>
                </div>
                <div>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="主题" prop="quo_theme">
                        <el-input v-model="quo.quo_theme" />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="客户" prop="quo_client">
                        <el-select style='width:100%' v-model="quo.quo_client">
                          <el-option label="－－无－－" value='' />
                          <el-option v-for="dict in cmessg" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="商机" prop="quo_predict">
                        <el-select style='width:100%' v-model="quo.predict_theme">
                          <el-option label="－－无－－" value='' />
                          <el-option v-for="dict in s_predict" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="客户等级" prop="">
                        <el-input v-model="empty" />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="联系人" prop="quo_contact">
                        <el-select style='width:100%' v-model="quo.quo_contact">
                          <el-option label="－－无－－" value='' />
                          <el-option v-for="dict in person" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="电子邮件地址" prop="quo_email">
                        <el-input v-model="quo.quo_email" />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="电话号码" prop="quo_phone">
                        <el-input v-model="quo.quo_phone" />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="传真号" prop="quo_fax">
                        <el-input v-model="quo.quo_fax" />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="地址" prop="quo_address">
                        <el-input type="textarea" v-model="quo.quo_address" ttparea=350></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="失效日期 " prop="quo_faildate">
                        <el-date-picker v-model="quo.quo_faildate" type="date" style='width:100%' value-format="yyyy-MM-dd" />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="内部备注" prop="quo_insides">
                        <el-input type="textarea" v-model="quo.quo_insides" ttparea=350></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </div>
                <el-button @click="gotoPage(''+vueparams+'')" type='primary' size="mini">保存</el-button>
                <el-button @click="gotoPage('/crm/sale/Offer?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>取消</el-button>
              </el-form>
            </td>
          </tr>
        </table>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'联系人'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'ContactsOfferUp',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        quo: {
          quo_theme: null,
          quo_client: null,
          predict_theme: null,
          quo_contact: null,
          quo_email: null,
          quo_phone: null,
          quo_fax: null,
          quo_address: null,
          quo_faildate: null,
          quo_insides: null,
        },
        cmessg: [],
        s_predict: [],
        person: [],
        loading: false,
        Container: null,
        Container2: null,
        rules: {
          quo_theme: [{
            required: true,
            message: "主题不能为空",
            trigger: 'blur',
          }],
          quo_client: [{
            required: true,
            message: "客户不能为空",
            trigger: 'blur',
          }],
          quo_faildate: [{
            required: true,
            message: "失效日期 不能为空",
            trigger: 'blur',
          }],
        }
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "80299289AF2443B18EA545A4C0C37170",
        name: "客户管理右菜单",
        selected: "联系人"
      }, 'Container', this.vueparams);
      this.loadContainerMenu({
        pid: "14ED91704E794C43A973E8BEFF724C15",
        name: "客户联系人右菜单",
        selected: "产品报价"
      }, 'Container2', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/crm/sale/contacts/ContactsOffer/contactsOfferUp?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
    },
  }
</script>
